package com.yoooya.base.model.qo;

/**
 * @创建人 Sun Yijing
 * @创建时间 2018-06-28
 */
public class PaginationQo {

	private static final long serialVersionUID = -3210891187465853549L;
	/**
	 * <code>totalSize</code>-总共记录数
	 */
	private int totalSize;

	/**
	 * <code>pageSize</code>-每页记录数(默认10条每页)
	 */
	private int pageSize = 10;

	/**
	 * <code>pageNumber</code>-当前页码(默认第1条每页)
	 */
	private int pageNumber;

	private int limit = 10;

	private int page = 1;

	public int getTotalSize() {
		return totalSize;
	}

	public void setTotalSize(int totalSize) {
		this.totalSize = totalSize;
	}

	public int getLimit() {
		return limit;
	}

	public void setLimit(int limit) {
		this.limit = limit;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getPageSize() {
		return limit;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageNumber() {
		return page;
	}

	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
		this.page = pageNumber;
	}

	/**
	 * 获取总页数
	 * 
	 * @return 总页数
	 */
	public int getTotalPage() {
		return (totalSize + limit - 1) / limit;
	}

	/**
	 * 获取分页起始行
	 * 
	 * @return 分页起始行
	 */
	public int getOffset() {
		return (page - 1) * limit;
	}
}
